package me.youline.dataServer.entity;

import java.util.Date;

import me.youline.dataServer.entity.PublicMessage.MsgStatus;

/**
 * 消息索引
 * @author linhan
 *
 */
public class PublicMessageIndex implements Comparable<PublicMessageIndex>{
	
	/**
	 * 消息ID
	 */
	private Long msgId;
	
	/**
	 * 消息创建人ID
	 */
	private Long creatorId;
	
	/**
	 * 展示效果图url
	 */
	private String displayPicUrl;
	
	/**
	 * 消息可见状态
	 */
	private MsgStatus msgStatus;
	
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	
	public PublicMessageIndex(Long msgId, Long creatorId, String displayPicUrl,
			MsgStatus msgStatus,Date createTime) {
		this.msgId = msgId;
		this.creatorId = creatorId;
		this.displayPicUrl = displayPicUrl;
		this.msgStatus = msgStatus;
		this.createTime = createTime;
	}

	public Long getMsgId() {
		return msgId;
	}

	public void setMsgId(Long msgId) {
		this.msgId = msgId;
	}

	public Long getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}

	public MsgStatus getMsgStatus() {
		return msgStatus;
	}

	public void setMsgStatus(MsgStatus msgStatus) {
		this.msgStatus = msgStatus;
	}

	public String getDisplayPicUrl() {
		return displayPicUrl;
	}

	public void setDisplayPicUrl(String displayPicUrl) {
		this.displayPicUrl = displayPicUrl;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((msgId == null) ? 0 : msgId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PublicMessageIndex other = (PublicMessageIndex) obj;
		if (msgId == null) {
			if (other.msgId != null)
				return false;
		} else if (!msgId.equals(other.msgId))
			return false;
		return true;
	}

	@Override
	public int compareTo(PublicMessageIndex o) {
		if( o == null){
			return 1;
		}
		return this.getMsgId().compareTo(o.getMsgId());
	}

	
	
}
